import { request } from '@/utils/request'

const base = '/accounts'

export function findMyCompanyAccounts (key, current = 1, pageSize = 10) {
  return request({
    url: base,
    method: 'get',
    params: {
      current,
      pageSize,
      key
    }
  })
}

export function addMyCompanyAccount (data) {
  return request({
    url: base,
    method: 'post',
    data
  })
}

export function deleteMyCompanyAccount (tenantId) {
  return request({
    url: `${base}/${tenantId}`,
    method: 'delete'
  })
}

export function updateMyCompanyAccounts (data) {
  return request({
    url: `${base}/${data.id}`,
    method: 'patch',
    data
  })
}

export function assignMyCompanyAccountRoles (data) {
  return request({
    url: `${base}/${data.id}/roles`,
    method: 'patch',
    data
  })
}
